#ifndef _IMSERVER_FCGI_IM_BASE_REQUEST_
#define _IMSERVER_FCGI_IM_BASE_REQUEST_

#include "im/adapters/user_profile_adapter.h"
#include "im/adapters/session_adapter.h"
#include "fcgi_service/fcgi_service.h"

using ::fcgi::Request; 

namespace imserver {
namespace fcgi {


class ImBaseRequest : public Request {
 public:
  ImBaseRequest(FCGX_Request* r) : Request(r), qid_(0), temp_id_(0) {}
 protected:
  void ParseUserIdentity();
  std::string ParseCallback();

  int64_t effective_id() const {
     return qid_ > 0 ? qid_ : temp_id_;
  }

  int64_t qid_;
  int64_t temp_id_;
};

}
}

#endif // _IMSERVER_FCGI_IM_BASE_REQUEST_

